<template>
  <div class="rights">
    <el-breadcrumb separator="/">
      <el-breadcrumb-item :to="{ path: '/backstage' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>权限管理</el-breadcrumb-item>
      <el-breadcrumb-item>权限列表</el-breadcrumb-item>
    </el-breadcrumb>
    <el-row style="padding: 15px 0;">
      <el-table :data="rightsData" border style="width: 100%">
        <el-table-column type="index" width="50"></el-table-column>
        <el-table-column prop="authName" label="权限名称"></el-table-column>
        <el-table-column prop="path" label="路径"></el-table-column>
        <el-table-column prop="level" label="层级">
          <template slot-scope="scope">
            <span v-if="scope.row.level == 0">一级</span>
            <span v-else-if="scope.row.level == 1">二级</span>
            <span v-else>三级</span>
          </template>
        </el-table-column>
      </el-table>
    </el-row>
  </div>
</template>
<script type="text/ecmascript-6">
import http from "@/api/port";
export default {
  data() {
    return {
      rightsData: []
    };
  },
  methods: {
    //获取所有权限
    getAllRights() {
      http("rights/list").then(res => {
        this.rightsData = res.data;
      });
    }
  },
  created() {
    this.getAllRights();
  }
};
</script>

<style scoped lang="scss">
.rights {
  background: #fff;
  border-radius: 5px;
  padding: 15px;
}
</style>
